package com.lvy.hczn.front.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.lvy.hczn.front.business.dto.Param;
import com.lvy.hczn.front.system.domain.business.GoodsBox;
import com.lvy.hczn.front.system.domain.business.SaleOrder;
import com.lvy.hczn.front.system.domain.business.SaleOrderDetail;
import com.lvy.hczn.front.system.domain.business.WarehousingEntry;

import java.util.List;

public interface WarehousingEntryService extends IService<WarehousingEntry> {


    /**
     * 入库单及状态查询
     *
     * @param entryCode
     * @param status
     * @param clientId
     * @param deliveryOrderCode
     * @return com.lvy.hczn.model.order.WarehousingEntry
     * @author yw
     * @date 2022-05-08 15:08:58
     */
    WarehousingEntry selectByEntryCodeAndStatus(String entryCode, String status, String clientId, String deliveryOrderCode) throws Exception;

    /**
     * 入库单及状态查询列表
     *
     * @param entryCode
     * @param status
     * @param clientId
     * @param deliveryOrderCode
     * @return com.lvy.hczn.model.order.WarehousingEntry
     * @author yw
     * @date 2022-05-08 15:08:58
     */
    List<WarehousingEntry> selectByEntryCodeAndStatusList(String entryCode, String status, String clientId, String deliveryOrderCode) throws Exception;

    /**
     * 出入库单据查询。
     * @param entryCode
     * @param status
     * @return
     */
    List<WarehousingEntry> selectByEntryCodeAndStatusList(String entryCode, String status);


    /**
     * 提交入库单到平台
     *
     * @param warehousingEntry
     * @return
     * @author yw
     * @date 2023-05-26 11:22:42
     */
    void commitToPlatform(WarehousingEntry warehousingEntry, boolean sortDone, boolean shelfLocation);

    /**
     * 提交入库单到平台(初始化值)
     *
     * @param param
     * @return
     * @author yw
     * @date 2023-05-26 11:22:42
     */
    void commitToPlatformInfo(Param param, String dataType, boolean sortDone);

    /**
     * 根据配送单，业务单，商品，sku,规格，等查询
     *
     * @param warehousingEntry
     * @param pageNum          为null则无limit
     * @return
     * @author yw
     * @date 2023-09-24 20:47:08
     */
    List<WarehousingEntry> selectOneByCondition(WarehousingEntry warehousingEntry, Integer pageNum);

    /**
     * 货箱出入库库位变更通知
     * 此方法两个场景，一个是单据出入库，另一个是仓库空箱出库或者指定货箱出库
     * 根据参数warehouse，如果是仓库指定出库，则无dataType
     *
     * @param list
     * @return void
     * @author yw
     * @date 2023-09-27 10:47:22
     */
    void boxShelfLocationMsg(List<WarehousingEntry> list, List<GoodsBox> goodsBoxList, boolean isWarehouse);

    /**
     * 根据数据类型以及商品获取单据
     *
     * @param dataType
     * @param saleOrder
     * @param saleOrderDetail
     * @return
     * @author yw
     * @date 2023-09-28 10:19:51
     */
    WarehousingEntry selectBySaleOrder(String dataType, SaleOrder saleOrder, SaleOrderDetail saleOrderDetail);

    /**
     * 生产日期等基本数据初始化
     *
     * @param warehousingEntry
     * @return void
     * @author yw
     * @date 2023-09-24 21:22:15
     */
    void initBaseData(WarehousingEntry warehousingEntry, String entryBatchCode);

    /**
     * 原料箱变空箱，库位变更通知(单个货箱)
     *
     * @param goodsBox
     * @param isWarehouse
     * @return void
     * @author yw
     * @date 2023-09-27 10:47:22
     */
    void boxShelfLocationMsgSingle(GoodsBox goodsBox, boolean isWarehouse);
}
